package com.atguigu.spring.demo17;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * 通常是工厂类实现 FactoryBean 接口
 * FactoryBean 接口的泛型使用工厂所生产产品的类型
 */
@Component("machineFactory")
public class Demo17MachineFactory implements FactoryBean<Machine> {
    @Override
    public Machine getObject() throws Exception {

        Machine machine = new Machine("比亚迪·秦", "蓝色", 1000000.0d);

        return machine;
    }

    @Override
    public Class<?> getObjectType() {
        return Machine.class;
    }
}
